//
//  JXTeacher.swift
//  JiaXiaoTong
//
//  Created by 沈增光 on 2018/2/2.
//  Copyright © 2018年 IT. All rights reserved.
//

import UIKit

class JXTeacher: NSObject {
    var teacherID : String?
    var actived : String?
    var contactAddress :String?
    var contactPhone : String?
    var createdDatetime  : String?
    var deleted  : String?
    var descr  :String?
    var duty : String?
    var email : String?
    
    var lastUpdater  :String?
    var nationality : String?
    var nickName : String?
    var teacherOperator  : String?
    var operatorId  :String?
    var operatorTime : String?
    var searchEndTime : String?
    
    var searchStartTime: String?
    var serchStratEndDate  : String?
    var sex :String?
    var sexName : String{
        if self.sex == "1"{
            return "男"
        }else if self.sex == "2"{
            
            return"nv"
        }
        
       
        return "保密"
    }
    var status : String?
    
    //教师 guid 标识
    var teacherGuid  :String?
    var teacherName : String?
    var teacherNo : String?
    var updateTime  : String?
    var updatedDatetime   :String?
    var version : String?
    var userId : String?
    
       func description() -> NSString {
        //        id modelClass = [self class];
        //        unsigned int outCount, i;
        //        objc_property_t *properties = class_copyPropertyList(modelClass, &outCount);
        //        NSMutableString *dict = [[NSMutableString alloc]init];
        //        //遍历出所有的属性key/value
        //        for (i = 0; i < outCount; i++) {
        //            objc_property_t property = properties[i];
        //            NSString *propName = [NSString stringWithUTF8String:property_getName(property)];
        //            id value = [[self valueForKey:propName] description];
        //            [dict appendFormat:@"\n   %@ : %@",propName,value];
        //        }
        //        return [NSString stringWithFormat:@" %@", dict];
        //
        var outCount:CUnsignedInt = 0
    
        let modelClass  = type(of: self).initialize()//type(of: self).init()
       // var   modelClass = JXTeacher()
    
        let properties = class_copyPropertyList(modelClass as? AnyClass, &outCount)
        let dict  = NSMutableString()
        for  i in 0..<outCount{
            let property = properties![Int(i)]
            let propName = NSString.init(utf8String: property_getName(property))
            self.value(forKey: propName! as String).debugDescription
            dict.append(dict as String)
      
        }
        return dict
    }
}
extension JXTeacher {
    
    class func mj_replacedKeyFromPropertyName()->NSDictionary {
        
       return ["teacherID":"id","teacherOperator":"operator"]
        
    }
    func setSexName(sexName:NSString) {
        if sexName == "男" {
            self.sex = "1"
        }else if sexName == "女"{
            
        }else{
            self.sex = "0";
        }
        
        
    }
    
    
    
    
    
    
}
